home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / misc / moonbas2 / vga.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-05  |  4.3 KB  |  135 lines

  1. //----------------------------------------------------------------------------
  2. // These classes handle the VGA card in mode 13h (320x200, 256 colors).
  3. //----------------------------------------------------------------------------
  4.  
  5. //----------------------------------------------------------------------------
  6. // TYPE  scr_xy_t
  7. //----------------------------------------------------------------------------
  8. // Defines a point in screen coordinates.  Used by WIN_poly ().
  9. //----------------------------------------------------------------------------
  10.  
  11. typedef struct
  12. {
  13.    int             x;
  14.    int             y;
  15. }
  16. scr_xy_t;
  17.  
  18. typedef scr_xy_t *    scr_xy_p_t;
  19. typedef scr_xy_p_t *  scr_xy_p_p_t;
  20.  
  21. //----------------------------------------------------------------------------
  22. // CLASS  vga_t
  23. //----------------------------------------------------------------------------
  24.  
  25. class              vga_t
  26. {
  27. public:
  28.  
  29.    // Check to see if there is a VGA display adapter.  Returns true if there
  30.    // is, false if there isn't.
  31.  
  32.    boolean         exists ( void );
  33.  
  34.    // Save the current video mode and switch to mode 13h.
  35.  
  36.    void            start  ( void );
  37.  
  38.    // Restore the previous video mode.
  39.  
  40.    void            end    ( void );
  41.  
  42.    // Fill the entire screen buffer with the given color.
  43.  
  44.    void            clear  ( int color );
  45.  
  46.    // Copy the drawing buffer into screen memory.
  47.  
  48.    void            update ( void );
  49. };
  50.  
  51. //----------------------------------------------------------------------------
  52. // CLASS  win_t
  53. //----------------------------------------------------------------------------
  54. // This class defines a rectangular region of the screen into which drawings
  55. // will be clipped.  Drawing occurs on the left and top edges, but not on the
  56. // right or bottom edges.
  57. //----------------------------------------------------------------------------
  58.  
  59. class              win_t
  60. {
  61. public:
  62.  
  63.    int             x1;    /* Left   */
  64.    int             y1;    /* Top    */
  65.    int             x2;    /* Right  */
  66.    int             y2;    /* Bottom */
  67.  
  68.    //-------------------------------------------------------------------------
  69.    // Resize the clipping window to the given coordinates.
  70.    //-------------------------------------------------------------------------
  71.  
  72.    void            resize ( int x1, int y1, int x2, int y2 );
  73.  
  74.    //-------------------------------------------------------------------------
  75.    // Fill the window with the given color.
  76.    //-------------------------------------------------------------------------
  77.  
  78.    void            clear  ( int color );
  79.  
  80.    //-------------------------------------------------------------------------
  81.    // Draw a point.
  82.    //-------------------------------------------------------------------------
  83.  
  84.    void            point  ( int x, int y, int color );
  85.  
  86.    //-------------------------------------------------------------------------
  87.    // Draw a line.
  88.    //-------------------------------------------------------------------------
  89.  
  90.    void            line   ( int x1, int y1, int x2, int y2, int color );
  91.  
  92.    //-------------------------------------------------------------------------
  93.    // Draw a filled rectangle.
  94.    //-------------------------------------------------------------------------
  95.  
  96.    void            rect
  97.    (
  98.       int          x1,
  99.       int          y1,
  100.       int          x2,
  101.       int          y2,
  102.       int          color
  103.    );
  104.  
  105.    //-------------------------------------------------------------------------
  106.    // Draw a filled convex polygon.  Points must be listed in clockwise order.
  107.    //-------------------------------------------------------------------------
  108.  
  109.    void            convex_poly
  110.    (
  111.       int          nr_points,
  112.       scr_xy_p_t   point_list,
  113.       int          color
  114.    );
  115.  
  116.    //-------------------------------------------------------------------------
  117.    // Draw a filled vertical trapezoid.
  118.    //-------------------------------------------------------------------------
  119.  
  120.    void            v_trapezoid
  121.    (
  122.       int          x1,
  123.       int          y1_t,
  124.       int          y1_b,
  125.       int          x2,
  126.       int          y2_t,
  127.       int          y2_b,
  128.       int          color
  129.    );
  130. };
  131.  
  132. //----------------------------------------------------------------------------
  133.  
  134. extern vga_t       vga;
  135.